/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ie.tcd.cs.railtickets.server.dao.impl;

import ie.tcd.cs.railtickets.server.dao.RouteTimeDAO;
import ie.tcd.cs.railtickets.server.domain.PathTime;
import ie.tcd.cs.railtickets.server.domain.RouteTime;
import static ie.tcd.cs.railtickets.server.dao.impl.HibernateSessionFactory.getSession;

/**
 *
 * @author Wenbo Sun
 */
public class RouteTimeDAOImpl extends AbstractBaseDAOImpl implements RouteTimeDAO {

    public RouteTime findByPathTime(PathTime pathTime) {
        String query = "select pathTime.routeTime from PathTime pathTime where pathTime = ?";
        Object o = getSession().createQuery(query).setParameter(0, pathTime).uniqueResult();
        if(o != null)
            return (RouteTime)o;
        return null;
    }


}
